/*This Library is an Official Property of The CIDSL Project  and The Author Siddharth Singh ..... And it is Protected by Law
 * in Case its Modification is Been Conducted in a Form Un-authorized by The GNU Foundation and Also The Appropriate Credits are to
 * BE Given to Project if this Library is Being Modified
 * 
 * 
 * Siddharth Singh,
 * Founder,
 * Ahcir Inc.*/
using System;
using Physics;
namespace Physics
{
	/* Changlogs and Daylogs
	 * Date: Wednesday 12:14  May 1 2013
		 * The Day Log :
		 *   I Have Decided The Structure of The Library  , The Struct Entity is The Primary Building Block of The  Project
		 * And The Functions Defined in The Library Would be The Ones That Would Extract The Data..... For More Information on The 
		 * Library Structure Contact Me .....
		 * 
		 * Siddharth Singh 
			*Changelog Date May 3 2013 
			 * The Entity Object Placed in The Top of Object Hiearchy so it would be accessible without the Inclusion of a Clas Soms
			 * as it was in before Commit, The Kinematics Section has been Started and Would be Completed First....
			 * 
			 * Changelog Date May 6 2013
			 * Assuming That User Has The Required Data to Fulfill The Information Requirements of The Other Function Which is Called
			 * but is not initialized to its Processed Values.. For This The Functions That Could Fullfil Th Requirements are
			 * Called So as The User-Called Function Can Complete its Processing Without Raising an Exception.....
			  * Changelog Commited By Siddharth Singh 
			  * 
			  * Changelog Date May 6 2013
			  * Added The Following to The Particle Dynamics Section Today:

*Calculation of Torque
*Calculation of Impulse
*Calculation of Duration of Force Applied in an Impulse
*Calculation of Angular Acceleration
*Calculation of Particle Jerk
*Calculation of Angular Velocity From Angular Momentum
*Calculation of Distance from Axis 


The Respective Vectors Corresponding to Both Above Functions and The Ones Previously Added Were Also Updated

May 8 Wednesday 
The Library has Been Re-Designed and Exception Handling has Been Implemented As a Result The Runtime of The Program is Not Stopped Because of One of The Function is Missing a Data Field.

The Following Functions have been Added


*Calculation of Current Time
*Calculation of Length of The Conductor
*Calculation of Area of Cross-Section of The Conductor
*Calculation of Net Charge
*Calculation of Number of Electrons
*Calculation of Mass  **/
	public struct entity
		{
		    public double? Force;
			public double? Current ;
			public double? ResistanceOfConductor;
		    public double? WorkDoneOnElectricCharge;
			public double? NetElectronCharge;
			public double? NumberOfElectrons;
			public double? CurrentTime;
			public double? InitialVelocity;
		    public double? InitialMomentum;
			public double? FinalVelocity;
		    public double? FinalMomentum;
		    public double? DistanceOfMotion;
		    public double? TimeOfMotion;
			public double? Momentum;
			public double? Velocity;
			public double? Acceleration;
			public double? Mass;
			public double? Weight;
			public double? GravitationalAcceleration;
		    public double? ConductorAreaOfCrossSection;
		    public double? ConductorLenght;
		    public double? ConductorResistance;
		    public double? PotentialDifferenceAcrossTwoEndsOfConductor;
		    public double? Resistivity;
		    public double? MomentOfInertia;
		    public double? DistanceBetweenAxisAndRotation;
		    public double? AngularMomentum;
		    public double? AngularVelocity;
		    public double? Jerk;
		    public double? AngularAcceleration;
		    public double? DurationInWhichForceIsApplied;
		    public double? Impulse;
		    public double? Torque;
		    public double? AngleBetweenForceVectorAndAxisOfRotation; 
		    public double? WorkDone;
		    public double? Displacement;
		    public bool DisplacementIsEqualToDistance;
		    public double? PotentialEnergy;
		    public double? KineticEnergy;
		    public double? InitialKineticEnergy;
		    public double? FinalKineticEnergy;
		    public double? VerticalDisplacement;
		    public double? GyroscopicPrecessionAngularVelocity;
		    public double? RotationalKineticEnergy;
		    public double? ElasticPotentialEnergy;
		    public double? SpringConstant;
		    public double? InitialAngularVelocity;
            public double? AngularJerk;
		    public double? FinalAngularVelocity;
		    public double? AngularDistanceOfMotion;
		    public double? AngularTimeOfMotion;
		    public double? InitialAngularMomentum;
		    public double? FinalAngularMomentum;
		    public double? InitialRotationalKineticEnergy;
		    public double? FinalRotationalKineticEnergy;
		    public double? InitialGyroscopicPrecessionAngularVelocity;
		    public double? FinalGyroscopicPrecessionAngularVelocity;
		    public double? RestoringElasticForce;
		    public double? AngularFrequency;
		    public double? OscillationTime;
		    public double? Amplitude;
	
		
		/*Remember to Put The Double in a Nullable state by putting Double?*/
		public double? CalculateCurrentTime()
		{

			if(NetElectronCharge.HasValue==true&&Current.HasValue==true){
			CurrentTime = NetElectronCharge/Current;
			}
			else{CurrentTime=null;}
			return CurrentTime;
			}
		public  double?   CalculateCurrent( )
		{

			if (NetElectronCharge.HasValue == true && CurrentTime.HasValue == true )
			{
			Current = NetElectronCharge / CurrentTime ;
			
			}
			else if ((NetElectronCharge.HasValue == false && NumberOfElectrons.HasValue == true) && CurrentTime.HasValue == true)
			{
				Current = (NumberOfElectrons * (1.6 * 10e-19)) / CurrentTime;
				
			}
			else if(PotentialDifferenceAcrossTwoEndsOfConductor.HasValue==true&&ResistanceOfConductor.HasValue==true){
                    Current = PotentialDifferenceAcrossTwoEndsOfConductor / ResistanceOfConductor;
                }
			else{Current=null;}
			return Current;
		}
			/*Calculation of Final Velocity*/
		public  double? CalculateFinalVelocity( )
		{
		
			
			if (TimeOfMotion.HasValue == true && Acceleration .HasValue == true && InitialVelocity.HasValue == true && DistanceOfMotion.HasValue != true)
			{
			  FinalVelocity = InitialVelocity + Acceleration * TimeOfMotion;
				
			}
			else if (Acceleration.HasValue == true && InitialVelocity.HasValue == true && DistanceOfMotion.HasValue == true && TimeOfMotion.HasValue !=true)
			{
				FinalVelocity = 2*Acceleration*DistanceOfMotion+InitialVelocity*InitialVelocity;
				FinalVelocity = (double?)Math.Pow((double)FinalVelocity,0.5) ;
			} 
			else if(FinalMomentum.HasValue==true&&Mass.HasValue==true){FinalVelocity=FinalMomentum/Mass;}
			else if (FinalKineticEnergy.HasValue==true&&Mass.HasValue==true)
			{
				FinalVelocity= FinalKineticEnergy/(1/2)*Mass;
				FinalVelocity = (double?)Math.Pow((double)FinalVelocity,0.5);
			}
			else{FinalVelocity=null;}
			return FinalVelocity;
		}
		/*Calculation of Initial Velocity*/
		public  double? CalculateInitialVelocity( )
		{
		
		if (FinalVelocity.HasValue == true && Acceleration.HasValue == true && TimeOfMotion.HasValue ==true && DistanceOfMotion.HasValue == false)
			{
				InitialVelocity = FinalVelocity - Acceleration * TimeOfMotion;
			 
			} 
			else if (FinalVelocity.HasValue == false && Acceleration.HasValue == true && TimeOfMotion.HasValue ==true && DistanceOfMotion.HasValue == true)
			{
				/*(s - 1/2at*t)/t=u*/
				InitialVelocity = (DistanceOfMotion - 1/2 *Acceleration*TimeOfMotion*TimeOfMotion)/TimeOfMotion;
			}
			else if(FinalVelocity.HasValue == true && Acceleration.HasValue == true && TimeOfMotion.HasValue ==false && DistanceOfMotion.HasValue == true)
			{
				/*2as-v*v=u*u*/
				InitialVelocity = 2*Acceleration*DistanceOfMotion-FinalVelocity*FinalVelocity;
				InitialVelocity = (double?)Math.Pow((double)InitialVelocity,0.5);
			}
			else if(InitialMomentum.HasValue==true&&Mass.HasValue==true){InitialVelocity=InitialMomentum/Mass;}
			else if (InitialKineticEnergy.HasValue==true&&Mass.HasValue==true)
			{
				InitialVelocity= InitialKineticEnergy/(1/2)*Mass;
				InitialVelocity = (double?)Math.Pow((double)InitialVelocity,0.5);
			}
			else{InitialVelocity=null;}
			return InitialVelocity;
		}
	/*Calculations of Ohm's Law Relations-Resistance
	 * V/I = R
	 * R = rho * L/A*/	
		public double? CalculateResistanceOfConductor()
		{

			
			if(PotentialDifferenceAcrossTwoEndsOfConductor.HasValue == true && Current.HasValue == true)
				
			{
				ResistanceOfConductor = PotentialDifferenceAcrossTwoEndsOfConductor / Current;
				
			}
			else if(PotentialDifferenceAcrossTwoEndsOfConductor.HasValue==true&&NumberOfElectrons.HasValue==true)
			{
				ResistanceOfConductor=PotentialDifferenceAcrossTwoEndsOfConductor/CalculateCurrent();
			}
			else if(PotentialDifferenceAcrossTwoEndsOfConductor.HasValue == false && Current.HasValue == false && Resistivity.HasValue == true && ConductorLenght.HasValue == true && ConductorAreaOfCrossSection.HasValue == true)
			{
				ResistanceOfConductor = Resistivity * (ConductorLenght/ConductorAreaOfCrossSection);
				
				
			}
			else{ResistanceOfConductor=null;}
			return ResistanceOfConductor;
		  	
		}
		/*Area of Cross Section of The Conductor
		 * R = rho * l/a
		 * R*A/L = RHO 
		 * R*A = RHO * L
		 * R * A / RHO = L*/
		public double? CalculateLenghtOfTheConductor()
		{
			if(ResistanceOfConductor.HasValue==true&&ConductorAreaOfCrossSection.HasValue==true&&Resistivity.HasValue==true)
			{
				ConductorLenght =  ResistanceOfConductor*ConductorAreaOfCrossSection/Resistivity;
			}
			else{ConductorLenght=null;}
			return ConductorLenght;
		}
		/*Area of Cross Section of The Conductor
		 * R = rho * l/a
		 * R*A/L = RHO 
		 * A = RHO *L / R */  
		public double? CalculateAreaOfCrossSectionOfConductor()
		{
		   if (Resistivity.HasValue==true&&ConductorLenght.HasValue==true&&ResistanceOfConductor.HasValue==true)
			{
				ConductorAreaOfCrossSection = Resistivity * ConductorLenght / ResistanceOfConductor;
			}
			else{ConductorAreaOfCrossSection=null;}
			return ConductorAreaOfCrossSection;
		}
        /*Calculating Resistivity
         * rho = r * (l/a)*/
		public double? CalculateResistivity()
		{

			if(ResistanceOfConductor.HasValue==true&&ConductorLenght.HasValue==true&&ConductorAreaOfCrossSection.HasValue==true){
			Resistivity = ResistanceOfConductor * (ConductorAreaOfCrossSection/ConductorLenght);
			}
			else{Resistivity=null;}
			return Resistivity;
		}
		/*Ohm's Law Potential Difference Calculation
		 * V = IR */
		public double? CalculatePotentialDifferenceAcrossTwoEndsofConductor()
		{

			if(Current.HasValue==true&&ResistanceOfConductor.HasValue==true)
			{
			PotentialDifferenceAcrossTwoEndsOfConductor = Current * ResistanceOfConductor;
			}
			else{PotentialDifferenceAcrossTwoEndsOfConductor=null;}
			return PotentialDifferenceAcrossTwoEndsOfConductor;
		}
		public double? CalculateNumberOfElectrons(){
		if(NetElectronCharge.HasValue==true)
			{
			NumberOfElectrons = NetElectronCharge/1.6*10e-19;
			}
		else{NumberOfElectrons=null;}
			return NumberOfElectrons;
		}
		public double? CalculateNetCharge()
		{
			if(NumberOfElectrons.HasValue==true){
	      NetElectronCharge = NumberOfElectrons * 1.6*10e-19;
			}
			else{NetElectronCharge=null;}
			return NetElectronCharge;
			
		}
		/*Calculation for Work Done on a Charge
		 * V = J/Q
		 * VQ = J*/ 
		public double? CalculationWorkDoneOnElectricCharge()
		{

			if(PotentialDifferenceAcrossTwoEndsOfConductor.HasValue==true&&NetElectronCharge.HasValue==true){
			WorkDoneOnElectricCharge = PotentialDifferenceAcrossTwoEndsOfConductor * NetElectronCharge;}
			else{WorkDoneOnElectricCharge=null;
			}
			return WorkDoneOnElectricCharge;
		}
		/*Calculation of Momentum and Velocity*/
		public double? CalculateVelocity()
		{
			if(Momentum.HasValue==true&&Mass.HasValue==true)
			{
				Velocity = Momentum/Mass;
			}
			if(Mass.HasValue==true&&KineticEnergy.HasValue==true)
			{
				Velocity = KineticEnergy / 1/2 * Mass;
				Velocity = (double?)Math.Sqrt((double)Velocity);
			}
			else{Velocity=null;}
			return Velocity;
		}
		
		public double? CalculateMomentum()
		{ 

		    if(Mass.HasValue==true&&Velocity.HasValue==true)
			{
		   Momentum = Mass * Velocity;
			}
			else{Momentum=null;}
			return Momentum;
		}
	   public double? CalculateAcceleration()
		{

			if(InitialVelocity.HasValue == true && FinalVelocity.HasValue == true&&TimeOfMotion.HasValue==true)
			{
				Acceleration = FinalVelocity- InitialVelocity/TimeOfMotion;
			}

			else if (FinalMomentum.HasValue == true && InitialMomentum.HasValue == true)
			{
				Acceleration = (FinalMomentum-InitialMomentum)/Mass;
			}
			else if (Jerk.HasValue == true && TimeOfMotion.HasValue == true)
			{
				Acceleration = Jerk / TimeOfMotion ;
			}
			else if (SpringConstant.HasValue==true&&Mass.HasValue==true&&Displacement.HasValue==true)
			{
				/*A = -1 * SC / MASS * DISPLACEMENT 
				 * A * MASS / DISPLACEMENT  = -1 * SC 
				 * (A * Mass / Displacement)  / -1 = SC
				 * A *Mass / SC * -1 = Displapcement 
				 *  A * Mass  / Displacement = -1 * SC 
				 *  (-1 * SC  * Displacement ) / Acceleration = Mass */
				Acceleration = -1*(SpringConstant/Mass)*Displacement;
			}
				
				else
			{
				Acceleration=null;
			}
			return Acceleration;
			
		}
		/*Calculation of Force
	     * F = ma*/
		public double? CalculateForce()
		{

			if(Acceleration.HasValue == true)
			{
			Force = Mass * Acceleration;
			}
			else if(Acceleration.HasValue == false)
			{
				Force = (FinalMomentum - InitialMomentum)/TimeOfMotion;
			}
			else if(DurationInWhichForceIsApplied.HasValue  == true && Impulse.HasValue == true)
			{
				Force = Impulse / DurationInWhichForceIsApplied;
			}
			else if(WorkDone.HasValue == true && Displacement.HasValue == true)
			{
				Force = WorkDone / Displacement;
			}
			else if(GyroscopicPrecessionAngularVelocity.HasValue==true&&DistanceBetweenAxisAndRotation.HasValue==true&&AngularMomentum.HasValue==true)
			{
				Force = GyroscopicPrecessionAngularVelocity*AngularMomentum/DistanceBetweenAxisAndRotation;
			}
			else
			{
			Force=null;
			}
			return Force;
		}
		 
		/*Calculation of Initial Momentum
		 * f = mv-mu
		 * mu = mv-f*/
		public double? CalculateInitialMomentum()
		{
		if (InitialVelocity.HasValue == true)
			{
			InitialMomentum = Mass * InitialVelocity;
			
			}
			else if(Force.HasValue == true && FinalMomentum.HasValue == true)
			{
				InitialMomentum = (FinalMomentum/TimeOfMotion) - Force;
			}
			else{InitialMomentum=null;}
			return InitialMomentum;
		}
	    /*Calculation of Final Momentum
	     * F = MV - MU
	     * F + MU = MV*/
		public double? CalculateFinalMomentum()
		{

			if(FinalVelocity.HasValue == true)
			{
			FinalMomentum = Mass * FinalVelocity;
			}
			else if(FinalVelocity.HasValue == false)
			{
				FinalMomentum = Mass * CalculateFinalVelocity();
			}
			else if (Force.HasValue == true && InitialMomentum.HasValue == true)
			{
				/*f = mv-mu/t*/
				FinalMomentum = Force + (InitialMomentum/TimeOfMotion);
				
			}
			else{FinalMomentum=null;}
			return FinalMomentum;
		}
		/*Calculation of Moment Of Inertia*/ 
		public double? CalculateMomentOfInertia()
		{
			if(Mass.HasValue==true&&DistanceBetweenAxisAndRotation.HasValue==true)
			{
			MomentOfInertia = Mass * DistanceBetweenAxisAndRotation * DistanceBetweenAxisAndRotation;
			}
			else if(RotationalKineticEnergy.HasValue==true&&AngularVelocity.HasValue==true)
			{
				MomentOfInertia= RotationalKineticEnergy / (1/2*AngularVelocity*AngularVelocity);
			}
			else{MomentOfInertia=null;}
				return MomentOfInertia;
		}
		/*Calculation of Angular Velocity*/
		public double? CalculateAngularMomentum()
		{

		   if(MomentOfInertia.HasValue == true && AngularVelocity.HasValue == true)
			{
				AngularMomentum = MomentOfInertia * AngularVelocity;
			}
			else if(MomentOfInertia.HasValue == false && Mass.HasValue == true && DistanceBetweenAxisAndRotation.HasValue == true)
			{
			AngularMomentum = CalculateMomentOfInertia() * AngularVelocity;
			}
				else if(Mass.HasValue==true&&AngularVelocity.HasValue==true&&DistanceBetweenAxisAndRotation.HasValue==true)
			{
				AngularMomentum = Mass * AngularVelocity * DistanceBetweenAxisAndRotation;
				/*Note The Angular Momentum Data Might Differ With Both Cases as The Second One Calculates The Angular 
				 * Momentum With Respect to a Point of Origin, That is it is Used When a Body is Small and is Rotating 
				 * Around a rConsiderably Larger Body, For Example Earth Moving Around The Sun or a Tin Can Moving Around
				 * Tied by a Long String....*/
			}
			if(GyroscopicPrecessionAngularVelocity.HasValue==true&&(Force.HasValue==true||Weight.HasValue==true)&&DistanceBetweenAxisAndRotation.HasValue==true)
			{
				
				if(Weight.HasValue==true){AngularMomentum=Weight*DistanceBetweenAxisAndRotation/GyroscopicPrecessionAngularVelocity;}
				if(Force.HasValue==true){AngularMomentum=Force*DistanceBetweenAxisAndRotation/GyroscopicPrecessionAngularVelocity;}
			}
			
			if(GyroscopicPrecessionAngularVelocity.HasValue==true&&Mass.HasValue==true&&GravitationalAcceleration.HasValue==true&&DistanceBetweenAxisAndRotation.HasValue==true)
			{
				AngularMomentum=Mass*GravitationalAcceleration*DistanceBetweenAxisAndRotation/GyroscopicPrecessionAngularVelocity;
			}
			
			else if(Torque.HasValue==true&&GyroscopicPrecessionAngularVelocity.HasValue==true)
			{
				AngularMomentum=Torque/GyroscopicPrecessionAngularVelocity;
			}
			else{AngularMomentum=null;}
			return AngularMomentum;
		}
		public double? CalculateDistanceBetweenAxisAndRotation()
		{

			if(AngularMomentum.HasValue==true&&AngularVelocity.HasValue==true&&Mass.HasValue==true)
			{DistanceBetweenAxisAndRotation = AngularMomentum / (Mass * AngularVelocity);}
			if(GyroscopicPrecessionAngularVelocity.HasValue==true&&AngularMomentum.HasValue==true&&(Force.HasValue==true||Weight.HasValue==true))
			{
				if(Force.HasValue==true){DistanceBetweenAxisAndRotation=GyroscopicPrecessionAngularVelocity*AngularMomentum/Force;}
				if(Weight.HasValue==true){DistanceBetweenAxisAndRotation=GyroscopicPrecessionAngularVelocity*AngularMomentum/Weight;}
			}
			if(GyroscopicPrecessionAngularVelocity.HasValue==true&&AngularMomentum.HasValue==true&&Mass.HasValue==true&&GravitationalAcceleration.HasValue==true)
			{
				DistanceBetweenAxisAndRotation=GyroscopicPrecessionAngularVelocity*AngularMomentum/Mass*GravitationalAcceleration;
			}
			else{DistanceBetweenAxisAndRotation=null;}
			return DistanceBetweenAxisAndRotation;
	
		}
		/*Calculating AngularVelocity From Angular Momentum*/
		public double? CalculateAngularVelocity()
		{
		if(MomentOfInertia.HasValue == true)
			{
				AngularVelocity = AngularMomentum / MomentOfInertia;
			}
			
			else if(Mass.HasValue==true&&AngularMomentum.HasValue==true&&DistanceBetweenAxisAndRotation.HasValue==true)
			{
				AngularVelocity = AngularMomentum/(Mass * DistanceBetweenAxisAndRotation);
			
			}
			else if(RotationalKineticEnergy.HasValue==true&&MomentOfInertia.HasValue==true)
			{
			   AngularVelocity = RotationalKineticEnergy/(1/2*MomentOfInertia);
			   AngularVelocity = (double?)Math.Sqrt((double)AngularVelocity);
			}
			else{AngularVelocity=null;}
			return AngularVelocity;
		}
			/*The Data Might Differ According To The Situation as Mentioned in Angular Momentum Case.......as The Second One Calculates The Angular 
				 * Momentum With Respect to a Point of Origin, That is it is Used When a Body is Small and is Rotating 
				 * Around a Considerably Larger Body, For Example Earth Moving Around The Sun or a Tin Can Moving Around
				 * Tied by a Long String....*/
			/*Calculation of Jerk ....
			 * J = A/T*/ 
			public double? CalculateJerk()
			{

			if(Acceleration.HasValue  == true && TimeOfMotion.HasValue == true)
			{
			Jerk  = Acceleration  / TimeOfMotion;
			}
			else{Jerk=null;}
			return Jerk;
			}
		    /* Calculation of Angular Acceleration */
		    public double? CalculateAngularAcceleration()
		{

			if (Momentum.HasValue == true && DistanceBetweenAxisAndRotation.HasValue == true)
			{
				AngularAcceleration = Momentum / DistanceBetweenAxisAndRotation;
			}
			else if(InitialAngularVelocity.HasValue == true && FinalAngularVelocity.HasValue == true&&AngularTimeOfMotion.HasValue==true)
			{
				AngularAcceleration = FinalAngularVelocity- InitialAngularVelocity/AngularTimeOfMotion;
			}

			
			else if (AngularJerk.HasValue == true && AngularTimeOfMotion.HasValue == true)
			{
				AngularAcceleration = AngularJerk / AngularTimeOfMotion ;
			}
			else{AngularMomentum=null;}
			return AngularMomentum;
		}
		
		/*Calcultion Of Impulse....
		 * Impulse = Force Times Time Interval*/
		public double? CalculateDurationOfForceAppliedForAnImpulse()
		{ 

		if(Impulse.HasValue==true&&Force.HasValue==true){DurationInWhichForceIsApplied = Impulse / Force;}
		else{DurationInWhichForceIsApplied=null;}
			return DurationInWhichForceIsApplied;
		}
		public double? CalculateImpulse()
		{
			if (Force.HasValue == true && DurationInWhichForceIsApplied.HasValue == true)
			{
				Impulse = Force * DurationInWhichForceIsApplied;
			}
			else{Force=null;};
			return Impulse;
		}
		
		/*Calculation of Torque*/
		public double? CalculateTorque()
		{
	
		    if(Force.HasValue==true&&DistanceBetweenAxisAndRotation.HasValue==true&&AngleBetweenForceVectorAndAxisOfRotation.HasValue==true)
			{
			Torque = Force * DistanceBetweenAxisAndRotation * (double?)Math.Sin((double)AngleBetweenForceVectorAndAxisOfRotation);
			}
			else  if(Weight.HasValue==true&&DistanceBetweenAxisAndRotation.HasValue==true&&AngleBetweenForceVectorAndAxisOfRotation.HasValue==true)
			{
			Torque = Weight * DistanceBetweenAxisAndRotation * (double?)Math.Sin((double)AngleBetweenForceVectorAndAxisOfRotation);
			}
			else if(GyroscopicPrecessionAngularVelocity.HasValue==true&&AngularMomentum.HasValue==true)
			{
				Torque=GyroscopicPrecessionAngularVelocity*AngularMomentum;
			}
			
			else{Torque=null;}
			return Torque;
		}
		/*Calculation of Work*
		 * W = F x D */
        public double? CalculateWorkDone()
		{
	
			if(Force.HasValue == false)
			{
				WorkDone = CalculateForce() * Displacement;
			}
			else if ( DisplacementIsEqualToDistance==true  && Force.HasValue == true)
			{
				WorkDone = Force * CalculateDistanceOfMotion();
			}
			else if(Force.HasValue == true && Displacement.HasValue==true)
			{
				WorkDone = Force * Displacement;
			}
			else
			{WorkDone=null;}
			return WorkDone;
		}
		
		/*Calculating Distance
		 * s = ut + 1/2 at*t
		 * s = v*v-u*u / 2a*/
		public double? CalculateDistanceOfMotion()
		{

			if(InitialVelocity.HasValue == true && Acceleration.HasValue == true && TimeOfMotion.HasValue==true)
			{
				DistanceOfMotion = InitialVelocity*TimeOfMotion+1/2*Acceleration*TimeOfMotion*TimeOfMotion;
			}
			else if(InitialVelocity.HasValue == false && Acceleration.HasValue == true && TimeOfMotion.HasValue==true)
			{
				DistanceOfMotion = CalculateInitialVelocity()*TimeOfMotion+1/2*Acceleration*TimeOfMotion*TimeOfMotion;
			}
			else if(InitialVelocity.HasValue == true && Acceleration.HasValue == false && TimeOfMotion.HasValue==true)
			{
				CalculateAcceleration();
				DistanceOfMotion = InitialVelocity*TimeOfMotion+1/2*Acceleration*TimeOfMotion*TimeOfMotion;
			}
			else if(InitialVelocity.HasValue == true && Acceleration.HasValue == true && TimeOfMotion.HasValue==false)
			{
				
				DistanceOfMotion = InitialVelocity*TimeOfMotion+1/2*Acceleration*TimeOfMotion*TimeOfMotion;
			}
			else{DistanceOfMotion=null;}
			return DistanceOfMotion;
		}
		/*Calculating Time of Motion
		 * v=u+at
		 * v-u=at
		 * v-u/a=t*/
		public double? CalculateTimeOfMotion()
		{
			if(FinalVelocity.HasValue ==  true && InitialVelocity.HasValue == true && Acceleration.HasValue == true){
			TimeOfMotion = FinalVelocity - InitialVelocity / Acceleration ;
			}
			else
			{TimeOfMotion=null;}
			return TimeOfMotion;
		}
		
		/*Calculate Mass*/
		public double? CalculateMass()
		{
	

			if(Weight.HasValue==true&&GravitationalAcceleration.HasValue==true){Mass=Weight/GravitationalAcceleration;}
			else if(AngularMomentum.HasValue==true&&AngularVelocity.HasValue==true&&DistanceBetweenAxisAndRotation.HasValue==true)
			{
				Mass  = AngularMomentum/AngularVelocity*DistanceBetweenAxisAndRotation;
			}
			else if(MomentOfInertia.HasValue==true&&DistanceBetweenAxisAndRotation.HasValue==true)
			{
				Mass = MomentOfInertia/DistanceBetweenAxisAndRotation*DistanceBetweenAxisAndRotation;
			}
			else if(FinalMomentum.HasValue==true&&FinalVelocity.HasValue==true)
			{
				Mass = FinalMomentum/FinalVelocity;
			}
			else if (InitialMomentum.HasValue==true&&InitialVelocity.HasValue==true)
			{
				Mass = InitialMomentum/InitialVelocity;
			}
			else if(Force.HasValue==true&&Acceleration.HasValue==true)
			{
				Mass = Force /Acceleration;

			}
			else if(FinalMomentum.HasValue==true&&InitialMomentum.HasValue==true&&Acceleration.HasValue==true)
			{
				Mass = (FinalMomentum-InitialMomentum)/Acceleration;
			}
			else if(Momentum.HasValue==true&&Velocity.HasValue==true)
			{
				Mass = Momentum/Velocity;
			}
			else if(PotentialEnergy.HasValue==true&&GravitationalAcceleration.HasValue==true&&VerticalDisplacement.HasValue==true)
			{
				Mass = PotentialEnergy/GravitationalAcceleration*VerticalDisplacement;
			}
			else if (Torque.HasValue==true&&DistanceBetweenAxisAndRotation.HasValue==true&&AngleBetweenForceVectorAndAxisOfRotation.HasValue==true&&GravitationalAcceleration.HasValue==true)
			{
				Mass = (Torque/DistanceBetweenAxisAndRotation * (double?)Math.Sin((double)AngleBetweenForceVectorAndAxisOfRotation))/GravitationalAcceleration;
				        
		    }
			/*Gyroscopic Precession*/
			
			else if(GyroscopicPrecessionAngularVelocity.HasValue==true&&AngularMomentum.HasValue==true&&GravitationalAcceleration.HasValue==true&&DistanceBetweenAxisAndRotation.HasValue==true)
			{
				Mass = GyroscopicPrecessionAngularVelocity*AngularMomentum/GravitationalAcceleration*DistanceBetweenAxisAndRotation;
			}
			/*  (-1 * SC  * Displacement ) / Acceleration = Mass */
				else if(SpringConstant.HasValue==true&&Displacement.HasValue==true&&Acceleration.HasValue==true)
			{
				Mass = (-1*SpringConstant*Displacement)/Acceleration;
			}
			else{Mass  = null;}
			return Mass;
		}
		
		public double?  CalculateWeight()
		{
			if(Mass.HasValue==true&&GravitationalAcceleration.HasValue==true)
			{
			Weight = Mass * GravitationalAcceleration;
			}
			if(PotentialEnergy.HasValue==true&&VerticalDisplacement.HasValue==true)
			{
				Weight=PotentialEnergy/VerticalDisplacement;
			}
			else if (Torque.HasValue==true&&DistanceBetweenAxisAndRotation.HasValue==true&&AngleBetweenForceVectorAndAxisOfRotation.HasValue==true)
			{Weight = Torque / DistanceBetweenAxisAndRotation * (double?)Math.Sin((double)AngleBetweenForceVectorAndAxisOfRotation);}
			else if(GyroscopicPrecessionAngularVelocity.HasValue==true&&DistanceBetweenAxisAndRotation.HasValue==true&&AngularMomentum.HasValue==true)
			{
				Weight = GyroscopicPrecessionAngularVelocity*AngularMomentum/DistanceBetweenAxisAndRotation;
			}
			else
			{Weight=null;}
			return Weight;
			}
		/*Calculating Potential Energy 
		 * PE = MGH
		 * PE/GH = M
		 * PE/MH = G
		 * PE/MG = H*/
		public double? CalculatePotentialEnergy()
		{
			if(Mass.HasValue==true&&GravitationalAcceleration.HasValue==true&&VerticalDisplacement.HasValue==true)
			{
				PotentialEnergy = Mass * GravitationalAcceleration * VerticalDisplacement;
			}
			else
			{PotentialEnergy=null;}
			return PotentialEnergy;
		}
		public double? CalculateGravitationalAcceleration()
		{
			if(Weight.HasValue==true&&Mass.HasValue==true)
			{
				GravitationalAcceleration = Weight/Mass;
			}
			else if(PotentialEnergy.HasValue==true&&Mass.HasValue==true&&VerticalDisplacement.HasValue==true)
			{
				GravitationalAcceleration= PotentialEnergy/Mass*VerticalDisplacement;
			}
			else if(GyroscopicPrecessionAngularVelocity.HasValue==true&&AngularMomentum.HasValue==true&&Mass.HasValue==true&&DistanceBetweenAxisAndRotation.HasValue==true)
			{
				GravitationalAcceleration=GyroscopicPrecessionAngularVelocity*AngularMomentum/DistanceBetweenAxisAndRotation*Mass;
			}
			else{GravitationalAcceleration=null;}
			return GravitationalAcceleration;
		}
		public double? CalculateVerticalDisplacement()
		{
			if(PotentialEnergy.HasValue==true&&Mass.HasValue==true&&GravitationalAcceleration.HasValue==true)
			{
				VerticalDisplacement=PotentialEnergy/Mass*GravitationalAcceleration;
			}
			else if(PotentialEnergy.HasValue==true&&Weight.HasValue==true)
			{
				VerticalDisplacement = PotentialEnergy/Weight;
			}
			else{VerticalDisplacement=null;}
			return VerticalDisplacement;
		}
		/*Kinetic Energy Section
		 *KE =  1/2 *M * V*V */
		public double? CalculateInitialKineticEnergy()
		{
			if(Mass.HasValue==true&&InitialVelocity.HasValue==true)
			{
				InitialKineticEnergy = 1/2 * Mass * InitialVelocity*InitialVelocity;
			}
			else
			{InitialKineticEnergy=null;}
			return InitialKineticEnergy;
			
		}
		public double? CalculateFinalKineticEnergy()
		{
			if(Mass.HasValue==true&&FinalVelocity.HasValue==true)
			{
				FinalKineticEnergy = 1/2 * Mass *FinalVelocity*FinalVelocity;
			}
			else{FinalKineticEnergy=null;}
			return FinalKineticEnergy;
		}
		
		public double? CalculateKineticEnergy()
		{
			if(Mass.HasValue==true&&Velocity.HasValue==true)
			{
				KineticEnergy=1/2*Mass*Velocity*Velocity;
			}
			else{KineticEnergy=null;}
			return KineticEnergy;
		}
		
	  /*Calculation of Gyroscopc Precession */
		public double? CalculateGyroscopicPrecessionAngularVelocity()
		{
			if((Weight.HasValue==true||Force.HasValue==true)&&DistanceBetweenAxisAndRotation.HasValue==true&&AngularMomentum.HasValue==true)
			{
				if(Weight.HasValue==true){GyroscopicPrecessionAngularVelocity = Weight*DistanceBetweenAxisAndRotation/AngularMomentum;}
                else if(Force.HasValue==true){GyroscopicPrecessionAngularVelocity=Force*DistanceBetweenAxisAndRotation/AngularMomentum;}			
			}
			else if(Mass.HasValue==true&&GravitationalAcceleration.HasValue==true&&DistanceBetweenAxisAndRotation.HasValue==true&&AngularMomentum.HasValue==true)
			{
				GyroscopicPrecessionAngularVelocity = Mass*GravitationalAcceleration*DistanceBetweenAxisAndRotation/AngularMomentum;
			}
			else if(Torque.HasValue==true&&DistanceBetweenAxisAndRotation.HasValue==true&&AngularMomentum.HasValue==true)
			{
				GyroscopicPrecessionAngularVelocity=Torque/AngularMomentum;
			}
			else{GyroscopicPrecessionAngularVelocity=null;}
			return GyroscopicPrecessionAngularVelocity;
		}
		/*Calculation of Rotational Kinetic Energy
		 * RKE = 1/2 * MOI * AV*AV */
		public double? CalculateRotationalKineticEnergy()
		{
			if(MomentOfInertia.HasValue==true&&AngularVelocity.HasValue==true)

			{
				RotationalKineticEnergy=1/2*MomentOfInertia*AngularVelocity*AngularVelocity;
			}
			else{RotationalKineticEnergy=null;}
			return RotationalKineticEnergy;
		}
		
		/*Calculation of Elastic Potential Energy
		 * EPE =  1/2 * Spring COnstant * Displacement ^ 2*/
		public double? CalculateElasticPotentialEnergy()
		{
			if(SpringConstant.HasValue==true&&Displacement.HasValue==true)
			{
				ElasticPotentialEnergy=1/2*SpringConstant*Displacement*Displacement;
			}
			
			else{ElasticPotentialEnergy=null;}
			return ElasticPotentialEnergy;
		}
		
		public double? CalculateSpringConstant()
		{
			if(ElasticPotentialEnergy.HasValue==true&&Displacement.HasValue==true)
			{
				SpringConstant = ElasticPotentialEnergy/(1/2*Displacement*Displacement);
			}
			if(RestoringElasticForce.HasValue==true&&Displacement.HasValue==true)
			{
				/*REF = -1 * SC * D */
				SpringConstant =  RestoringElasticForce/Displacement*-1;
				
			}
			/*(A * Mass / Displacement)  / -1 = SC*/
			else if (Acceleration.HasValue==true && Mass.HasValue==true&&Displacement.HasValue==true)
			{
				SpringConstant = (Acceleration*Mass/Displacement)/-1;
			}
				
			else{SpringConstant=null;}
			return SpringConstant;
		}
		public double? CalculateDisplacement()
		{
			if(WorkDone.HasValue==true&&Force.HasValue==true)
			{
				Displacement = WorkDone/Force;
			}
			else if(SpringConstant.HasValue==true&&ElasticPotentialEnergy.HasValue==true)
			{
				Displacement = ElasticPotentialEnergy/(1/2*SpringConstant);
				Displacement = (double?)Math.Sqrt((double)Displacement);
			}
			else if (SpringConstant.HasValue==true&&RestoringElasticForce.HasValue==true)
			{
				Displacement = RestoringElasticForce / -1 * SpringConstant;
			}
			// A *Mass / SC * -1 = Displapcement
			else if (Acceleration.HasValue==true&&Mass.HasValue==true&&SpringConstant.HasValue==true)
			{
				Displacement = Acceleration * Mass/SpringConstant * -1 ;
			}
			/*Calculation of Displacement in Simple Harmonic Motion */
			//Part To be Done
			else if (AngularFrequency.HasValue==true&&Amplitude.HasValue==true&&OscillationTime.HasValue==true)
			{
				Displacement = Amplitude*(double?)Math.Sin((double)AngularFrequency*(double)OscillationTime);
			}
			else{Displacement=null;}
			return Displacement;
		}
		
		/*Equations of Angular Motion With Constant Acceleration
		 * >Equations of Angular Motions(Done)
		 * >Equations of Angular Momentum(Done)
		 * >Equations of Rotational Kinetic Energy(Done) */
		public  double? CalculateFinalAngularVelocity( )
		{
		
			
			if (AngularTimeOfMotion.HasValue == true && AngularAcceleration .HasValue == true && InitialAngularVelocity.HasValue == true && AngularDistanceOfMotion.HasValue != true)
			{
			  FinalAngularVelocity = InitialAngularVelocity + AngularAcceleration * AngularTimeOfMotion;
				
			}
			else if (AngularAcceleration.HasValue == true && InitialAngularVelocity.HasValue == true && AngularDistanceOfMotion.HasValue == true && AngularTimeOfMotion.HasValue !=true)
			{
				FinalAngularVelocity = 2*AngularAcceleration*AngularDistanceOfMotion+InitialAngularVelocity*InitialAngularVelocity;
				FinalAngularVelocity = (double?)Math.Pow((double)FinalAngularVelocity,0.5) ;
			} 
			
			else{FinalAngularVelocity=null;}
			return FinalAngularVelocity;
		}
		/*Calculation of Initial Velocity*/
		public  double? CalculateInitialAngularVelocity( )
		{
		
		if (FinalAngularVelocity.HasValue == true && AngularAcceleration.HasValue == true && AngularTimeOfMotion.HasValue ==true && AngularDistanceOfMotion.HasValue == false)
			{
				InitialAngularVelocity = FinalAngularVelocity - AngularAcceleration * AngularTimeOfMotion;
			 
			} 
			else if (FinalAngularVelocity.HasValue == false && AngularAcceleration.HasValue == true && AngularTimeOfMotion.HasValue ==true && AngularDistanceOfMotion.HasValue == true)
			{
				/*(s - 1/2at*t)/t=u*/
				InitialAngularVelocity = (AngularDistanceOfMotion - 1/2 *AngularAcceleration*AngularTimeOfMotion*AngularTimeOfMotion)/AngularTimeOfMotion;
			}
			else if(FinalAngularVelocity.HasValue == true && AngularAcceleration.HasValue == true && AngularTimeOfMotion.HasValue ==false && AngularDistanceOfMotion.HasValue == true)
			{
				/*2as-v*v=u*u*/
				InitialAngularVelocity = 2*AngularAcceleration*AngularDistanceOfMotion-FinalAngularVelocity*FinalAngularVelocity;
				InitialAngularVelocity = (double?)Math.Pow((double)InitialAngularVelocity,0.5);
				InitialAngularVelocity = InitialAngularVelocity* -1;
			}
			
			else{InitialAngularVelocity=null;}
			return InitialAngularVelocity;
}
public double? CalculateAngularJerk()
			{

			if(AngularAcceleration.HasValue  == true && AngularTimeOfMotion.HasValue == true)
			{
			AngularJerk  = AngularAcceleration  / AngularTimeOfMotion;
			}
			else{AngularJerk=null;}
			return AngularJerk;
			}

/*Calculating Distance
		 * s = ut + 1/2 at*t
		 * s = v*v-u*u / 2a*/
		public double? CalculateAngularDistanceOfMotion()
		{

			if(InitialAngularVelocity.HasValue == true && AngularAcceleration.HasValue == true && AngularTimeOfMotion.HasValue==true)
			{
				AngularDistanceOfMotion = InitialAngularVelocity*AngularTimeOfMotion+1/2*AngularAcceleration*AngularTimeOfMotion*AngularTimeOfMotion;
			}
			else if(InitialAngularVelocity.HasValue == false && AngularAcceleration.HasValue == true && AngularTimeOfMotion.HasValue==true)
			{
				AngularDistanceOfMotion = CalculateInitialAngularVelocity()*AngularTimeOfMotion+1/2*AngularAcceleration*AngularTimeOfMotion*AngularTimeOfMotion;
			}
			else if(InitialAngularVelocity.HasValue == true && AngularAcceleration.HasValue == false && AngularTimeOfMotion.HasValue==true)
			{
				CalculateAngularAcceleration();
				AngularDistanceOfMotion = InitialAngularVelocity*AngularTimeOfMotion+1/2*AngularAcceleration*AngularTimeOfMotion*AngularTimeOfMotion;
			}
			else if(InitialAngularVelocity.HasValue == true && AngularAcceleration.HasValue == true && AngularTimeOfMotion.HasValue==false)
			{
				
				AngularDistanceOfMotion = InitialAngularVelocity*AngularTimeOfMotion+1/2*AngularAcceleration*AngularTimeOfMotion*AngularTimeOfMotion;
			}
			else{AngularDistanceOfMotion=null;}
			return AngularDistanceOfMotion;
		}
		/*Calculating Time of Motion
		 * v=u+at
		 * v-u=at
		 * v-u/a=t*/
		public double? CalculateAngularTimeOfMotion()
		{
			if(FinalAngularVelocity.HasValue ==  true && InitialAngularVelocity.HasValue == true && AngularAcceleration.HasValue == true){
			AngularTimeOfMotion = FinalAngularVelocity - InitialAngularVelocity / AngularAcceleration ;
			}
			else
			{AngularTimeOfMotion=null;}
			return AngularTimeOfMotion;
		}
		
		public double? CalculateInitialRotationalKineticEnergy()
		{
			if(MomentOfInertia.HasValue==true&&InitialAngularVelocity.HasValue==true)

			{
				InitialRotationalKineticEnergy=1/2*MomentOfInertia*InitialAngularVelocity*InitialAngularVelocity;
			}
			else{InitialRotationalKineticEnergy=null;}
			return InitialRotationalKineticEnergy;
		}

		public double? CalculateFinalRotationalKineticEnergy()
		{
			if(MomentOfInertia.HasValue==true&&FinalAngularVelocity.HasValue==true)

			{
				FinalRotationalKineticEnergy=1/2*MomentOfInertia*FinalAngularVelocity*FinalAngularVelocity;
			}
			else{FinalRotationalKineticEnergy=null;}
			return FinalRotationalKineticEnergy;
		}

		public double? CalculateInitialAngularMomentum()
		{

		   if(MomentOfInertia.HasValue == true && InitialAngularVelocity.HasValue == true)
			{
				InitialAngularMomentum = MomentOfInertia * InitialAngularVelocity;
			}
			else if(MomentOfInertia.HasValue == false && Mass.HasValue == true && DistanceBetweenAxisAndRotation.HasValue == true)
			{
			InitialAngularMomentum = CalculateMomentOfInertia() * InitialAngularVelocity;
			}
				else if(Mass.HasValue==true&&InitialAngularVelocity.HasValue==true&&DistanceBetweenAxisAndRotation.HasValue==true)
			{
				InitialAngularMomentum = Mass * InitialAngularVelocity * DistanceBetweenAxisAndRotation;
				/*Note The Angular Momentum Data Might Differ With Both Cases as The Second One Calculates The Angular 
				 * Momentum With Respect to a Point of Origin, That is it is Used When a Body is Small and is Rotating 
				 * Around a rConsiderably Larger Body, For Example Earth Moving Around The Sun or a Tin Can Moving Around
				 * Tied by a Long String....*/
			}
			else if(InitialGyroscopicPrecessionAngularVelocity.HasValue==true&&(Force.HasValue==true||Weight.HasValue==true)&&DistanceBetweenAxisAndRotation.HasValue==true)
			{
				
				if(Weight.HasValue==true){InitialAngularMomentum=Weight*DistanceBetweenAxisAndRotation/InitialGyroscopicPrecessionAngularVelocity;}
				else if(Force.HasValue==true){InitialAngularMomentum=Force*DistanceBetweenAxisAndRotation/InitialGyroscopicPrecessionAngularVelocity;}
			}
			
			else if(InitialGyroscopicPrecessionAngularVelocity.HasValue==true&&Mass.HasValue==true&&GravitationalAcceleration.HasValue==true&&DistanceBetweenAxisAndRotation.HasValue==true)
			{
				InitialAngularMomentum=Mass*GravitationalAcceleration*DistanceBetweenAxisAndRotation/InitialGyroscopicPrecessionAngularVelocity;
			}
			
			else if(Torque.HasValue==true&&InitialGyroscopicPrecessionAngularVelocity.HasValue==true)
			{
				InitialAngularMomentum=Torque/InitialGyroscopicPrecessionAngularVelocity;
			}
			else{InitialAngularMomentum=null;}
			return InitialAngularMomentum;
		}
		
		public double? CalculateFinalAngularMomentum()
		{

		   if(MomentOfInertia.HasValue == true && FinalAngularVelocity.HasValue == true)
			{
				FinalAngularMomentum = MomentOfInertia * FinalAngularVelocity;
			}
			else if(MomentOfInertia.HasValue == false && Mass.HasValue == true && DistanceBetweenAxisAndRotation.HasValue == true)
			{
			FinalAngularMomentum = CalculateMomentOfInertia() * FinalAngularVelocity;
			}
				else if(Mass.HasValue==true&&FinalAngularVelocity.HasValue==true&&DistanceBetweenAxisAndRotation.HasValue==true)
			{
				FinalAngularMomentum = Mass * FinalAngularVelocity * DistanceBetweenAxisAndRotation;
				/*Note The Angular Momentum Data Might Differ With Both Cases as The Second One Calculates The Angular 
				 * Momentum With Respect to a Point of Origin, That is it is Used When a Body is Small and is Rotating 
				 * Around a rConsiderably Larger Body, For Example Earth Moving Around The Sun or a Tin Can Moving Around
				 * Tied by a Long String....*/
			}
			if(FinalGyroscopicPrecessionAngularVelocity.HasValue==true&&(Force.HasValue==true||Weight.HasValue==true)&&DistanceBetweenAxisAndRotation.HasValue==true)
			{
				
				if(Weight.HasValue==true){FinalAngularMomentum=Weight*DistanceBetweenAxisAndRotation/FinalGyroscopicPrecessionAngularVelocity;}
				if(Force.HasValue==true){FinalAngularMomentum=Force*DistanceBetweenAxisAndRotation/FinalGyroscopicPrecessionAngularVelocity;}
			}
			
			if(FinalGyroscopicPrecessionAngularVelocity.HasValue==true&&Mass.HasValue==true&&GravitationalAcceleration.HasValue==true&&DistanceBetweenAxisAndRotation.HasValue==true)
			{
				FinalAngularMomentum=Mass*GravitationalAcceleration*DistanceBetweenAxisAndRotation/FinalGyroscopicPrecessionAngularVelocity;
			}
			
			else if(Torque.HasValue==true&&FinalGyroscopicPrecessionAngularVelocity.HasValue==true)
			{
				FinalAngularMomentum=Torque/FinalGyroscopicPrecessionAngularVelocity;
			}
			else{FinalAngularMomentum=null;}
			return FinalAngularMomentum;
		}
		 /*Calculation of Gyroscopc Precession */
		public double? CalculateInitialGyroscopicPrecessionAngularVelocity()
		{
			if((Weight.HasValue==true||Force.HasValue==true)&&DistanceBetweenAxisAndRotation.HasValue==true&&InitialAngularMomentum.HasValue==true)
			{
				if(Weight.HasValue==true){InitialGyroscopicPrecessionAngularVelocity = Weight*DistanceBetweenAxisAndRotation/InitialAngularMomentum;}
                else if(Force.HasValue==true){InitialGyroscopicPrecessionAngularVelocity=Force*DistanceBetweenAxisAndRotation/InitialAngularMomentum;}			
			}
			else if(Mass.HasValue==true&&GravitationalAcceleration.HasValue==true&&DistanceBetweenAxisAndRotation.HasValue==true&&InitialAngularMomentum.HasValue==true)
			{
				InitialGyroscopicPrecessionAngularVelocity = Mass*GravitationalAcceleration*DistanceBetweenAxisAndRotation/InitialAngularMomentum;
			}
			else if(Torque.HasValue==true&&DistanceBetweenAxisAndRotation.HasValue==true&&InitialAngularMomentum.HasValue==true)
			{
				InitialGyroscopicPrecessionAngularVelocity=Torque/InitialAngularMomentum;
			}
			else{InitialGyroscopicPrecessionAngularVelocity=null;}
			return InitialGyroscopicPrecessionAngularVelocity;
		}
		 /*Calculation of Gyroscopc Precession */
		public double? CalculateFinalGyroscopicPrecessionAngularVelocity()
		{
			if((Weight.HasValue==true||Force.HasValue==true)&&DistanceBetweenAxisAndRotation.HasValue==true&&FinalAngularMomentum.HasValue==true)
			{
				if(Weight.HasValue==true){FinalGyroscopicPrecessionAngularVelocity = Weight*DistanceBetweenAxisAndRotation/FinalAngularMomentum;}
                else if(Force.HasValue==true){FinalGyroscopicPrecessionAngularVelocity=Force*DistanceBetweenAxisAndRotation/FinalAngularMomentum;}			
			}
			else if(Mass.HasValue==true&&GravitationalAcceleration.HasValue==true&&DistanceBetweenAxisAndRotation.HasValue==true&&FinalAngularMomentum.HasValue==true)
			{
				FinalGyroscopicPrecessionAngularVelocity = Mass*GravitationalAcceleration*DistanceBetweenAxisAndRotation/FinalAngularMomentum;
			}
			else if(Torque.HasValue==true&&DistanceBetweenAxisAndRotation.HasValue==true&&FinalAngularMomentum.HasValue==true)
			{
				FinalGyroscopicPrecessionAngularVelocity=Torque/FinalAngularMomentum;
			}
			else{FinalGyroscopicPrecessionAngularVelocity=null;}
			return FinalGyroscopicPrecessionAngularVelocity;
		}
		/*Equations of Angular Motion with Constant Acceleration*/
		
		public double? CalculateRestoringElasticForce()
		{
			/* REF = -SC * D */
			if(SpringConstant.HasValue==true&&Displacement.HasValue==true)
			{
				RestoringElasticForce= -1 * SpringConstant * Displacement;
			}
			else{RestoringElasticForce = null;}
			return RestoringElasticForce;
		}
		
		public double? CalculateAmplitude()
		{
			if (OscillationTime.HasValue==true&&AngularFrequency.HasValue==true&&Displacement.HasValue==true)
			{
				Amplitude = Displacement / (double?)Math.Sin((double)AngularFrequency*(double)OscillationTime);
			}
			else {Amplitude=null;}
			return Amplitude;
		}
			
    		
	
	}


	
}